package com.adapter.pattern.adapter;

import com.adapter.pattern.service.AC220;
import com.adapter.pattern.service.DC5;
import sun.dc.pr.PRError;

import javax.xml.crypto.Data;

/**
 * @author cc
 * @classname PowerAdapter
 * @description 电源适配器
 * @date 2022/3/28 14:56
 */
public class PowerAdapter implements DC5 {

    private AC220 ac220;

    public PowerAdapter(AC220 ac220) {
        this.ac220 = ac220;
    }

    @Override
    public int output5V() {
        int adapterInput = ac220.output220V();
        //变压器
        int adapterOutput = adapterInput / 44;
        System.out.println("使用PowerAdapter输入AC:"+adapterInput+"V，"+"输出DC:"+adapterOutput+"V");
        return adapterOutput;
    }
}
